<template>
  <el-row :gutter="gap">
    <el-col v-for="(span, index) in cols" :key="index" :span="span">
      <slot :index="index" />
    </el-col>
  </el-row>
  
</template>

<script setup>
import { computed } from 'vue'

const props = defineProps({
  gap: { type: Number, default: 0 },
  // 支持直接传数组 [12,12] 或者字符串 "12:12"
  col: { type: [String, Array], default: () => [24] }
})

const cols = computed(() => {
  if (Array.isArray(props.col)) return props.col
  if (typeof props.col === 'string') {
    return props.col.split(':').map(n => Number(n) || 0)
  }
  return [24]
})
</script>
